package com.ly.heart.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.MeetingRoomScheduleMapper;
import com.ly.heart.service.IMeetingRoomScheduleService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.MeetingRoomScheduleEntity;

import javax.annotation.Resource;

/**
 * 会议室预定信息Service业务层处理
 *
 * @author cxl
 * @date 2024-06-13
 */
@Service
public class MeetingRoomScheduleServiceImpl extends ServiceImpl<MeetingRoomScheduleMapper,MeetingRoomScheduleEntity> implements IMeetingRoomScheduleService {

    @Resource
    private MeetingRoomScheduleMapper meetingRoomScheduleMapper;

    /**
     * 查询会议室预定信息
     *
     * @param id 会议室预定信息ID
     * @return 会议室预定信息
     */
    @Override
    public MeetingRoomScheduleEntity selectMeetingRoomScheduleEntityById(String id)
    {
        return meetingRoomScheduleMapper.selectMeetingRoomScheduleEntityById(id);
    }

    /**
     * 查询会议室预定信息列表
     *
     * @param meetingRoomScheduleEntity 会议室预定信息
     * @return 会议室预定信息
     */
    @Override
    public List<MeetingRoomScheduleEntity> selectMeetingRoomScheduleEntityList(MeetingRoomScheduleEntity meetingRoomScheduleEntity)
    {
        return meetingRoomScheduleMapper.selectMeetingRoomScheduleEntityList(meetingRoomScheduleEntity);
    }

    /**
     * 新增会议室预定信息
     *
     * @param meetingRoomScheduleEntity 会议室预定信息
     * @return 结果
     */
    @Override
    public int insertMeetingRoomScheduleEntity(MeetingRoomScheduleEntity meetingRoomScheduleEntity)
    {
        meetingRoomScheduleEntity.setId(SnowflakeIdWorker.getInstance().nextStringId());
        meetingRoomScheduleEntity.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
        meetingRoomScheduleEntity.setCreateTime(DateUtils.getNowDate());
        return meetingRoomScheduleMapper.insertMeetingRoomScheduleEntity(meetingRoomScheduleEntity);
    }

    /**
     * 修改会议室预定信息
     *
     * @param meetingRoomScheduleEntity 会议室预定信息
     * @return 结果
     */
    @Override
    public int updateMeetingRoomScheduleEntity(MeetingRoomScheduleEntity meetingRoomScheduleEntity)
    {
        meetingRoomScheduleEntity.setChangeTime(DateUtils.getNowDate());
        return meetingRoomScheduleMapper.updateMeetingRoomScheduleEntity(meetingRoomScheduleEntity);
    }

    /**
     * 批量删除会议室预定信息
     *
     * @param ids 需要删除的会议室预定信息ID
     * @return 结果
     */
    @Override
    public int deleteMeetingRoomScheduleEntityByIds(String[] ids)
    {
        return meetingRoomScheduleMapper.deleteMeetingRoomScheduleEntityByIds(ids);
    }

    /**
     * 删除会议室预定信息信息
     *
     * @param id 会议室预定信息ID
     * @return 结果
     */
    @Override
    public int deleteMeetingRoomScheduleEntityById(String id)
    {
        return meetingRoomScheduleMapper.deleteMeetingRoomScheduleEntityById(id);
    }
}
